/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = frstr.h                                            */
/*  NOTE      =                                                    */
/*  DATE      = 2014/09/29 by yaohl                                */
/*******************************************************************/

#ifndef __FRSTR_H_
#define __FRSTR_H_

/* 公用字符串操作函数 */
typedef struct __st_string
{
    char *p_str;
    unsigned int ui_len;
    unsigned int ui_allocated_size;
} Frstr;

Frstr* frstr_new(unsigned int ui_size);

int  frstr_append(Frstr *p_frstr, const char *p_append_val, unsigned int ui_append_size);
void frstr_trunc(Frstr *p_frstr, unsigned int ui_len);
//unsigned int frstr_size(Frstr *p_frstr);

//获取内存空间大小
#define FRSTR_SIZE(x) ( (x)?x->ui_allocated_size:0)
//获取已经使用内存大小
#define FRSTR_LEN(x) ( (x)?x->ui_len:0)

void frstr_free(Frstr **pp_frstr);
char *frstr_free2(Frstr **pp_frstr);

#endif

